import React from 'react';
import { Col, Form, Row } from 'antd';
import styles from '@/pages/Organization/Orgs/View.less';
import AuthComponent from '@/utils/auth/AuthComponent';

const { Item } = Form;

const DepartmentContent = ({
    // data,
    data: { name, oneDeptCount, employeeCount, managerName, companyName, planNum, cdType }
    // onEmployeeAdd,
    // onDepartmentAdd
}) => (
    <div className={styles.departmentContent}>
        <Row type="flex" className={styles.title} justify="space-between">
            <Col className={styles.name}>
                {name}
                {!Number.isNaN(employeeCount) && `(${employeeCount})`}
            </Col>
            {/* <AuthComponent code="office:orgs:employee:add">
                <Col className={styles.addRg}>
                    <a
                        href="#"
                        onClick={e => onEmployeeAdd(data, e)}
                    >
                    添加员工
                    </a>
                </Col>
            </AuthComponent> */}
        </Row>
        <Form labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}>
            <Item label="所属公司">{companyName || name}</Item>
            <Item label="部门主管">
                <Row type="flex" justify="space-between">
                    <Col>{managerName}</Col>
                    <AuthComponent code="office:orgs:employee:department:edit">
                        {/*                    {cdType === 1 && (
                        <Col>
                            <a href="#" onClick={e => onDepartmentEdit(data, e)}>设置部门</a>
                        </Col>
                    )} */}
                    </AuthComponent>
                </Row>
            </Item>
            <Item label="下属一级部门">
                <Row type="flex" justify="space-between">
                    <Col>{oneDeptCount} 个</Col>
                    {/* <AuthComponent code="office:orgs:employee:department:add">
                        <Col>
                            <a
                                onClick={e => onDepartmentAdd(data, e)}
                                href="#"
                            >
                            添加子部门
                            </a>
                        </Col>
                    </AuthComponent> */}
                </Row>
            </Item>
            {cdType === 1 && (
                <Item label="部门编制">
                    <Row type="flex" justify="space-between">
                        <Col>
                            {planNum || '-'} {planNum ? '人' : ''}
                        </Col>
                    </Row>
                </Item>
            )}
        </Form>
    </div>
);

export default DepartmentContent;
